<?php require_once('../Connections/phpsat.php');
		@include('config.php');
 ?>
<?php
if(@isset($_POST['email'],$_POST['senha'])){
	$email = $_POST['email'];
$senha = $_POST['senha'];
	
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}



mysql_select_db($database_phpsat, $phpsat);
$query_RSLogin = "select * from aluno where email = '$email' and senha = '$senha'";
$RSLogin = mysql_query($query_RSLogin, $phpsat) or die(mysql_error());
$row_RSLogin = mysql_fetch_assoc($RSLogin);
$totalRows_RSLogin = mysql_num_rows($RSLogin);

mysql_free_result($RSLogin);

 if($totalRows_RSLogin > 0 or $email == $emailprof and $senha == $senhaprof) {
	
	$_SESSION['email'] = $email;
	$_SESSION['senha'] = $senha;
	
	header("Location: index.php");
	
	}
	
	else if($totalRows_RSLogin < 1) {
	
	echo '<script>alert("E-mail ou Senha inválidos.    Verifique se o CapsLock está ativado.");</script>';
	
	}
		
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript">
</script>
<script src="jquery-validation-1.9.0/jquery.validate.js"></script>
<link rel="stylesheet" href="css/stylevalidator.css" type="text/css">

<script type="text/javascript">
$(document).ready( function() {
$("#form").validate({
// Define as regras
rules:{
email:{
// campoEmail será obrigatório (required) e precisará ser um e-mail válido (email)
required: true, email: true
},
senha:{
// campoMensagem será obrigatório (required) e terá tamanho mínimo (minLength)
required: true,
}
},
// Define as mensagens de erro para cada regra
messages:{
email:{
required: "Digite o seu e-mail para entrar",
email: "Digite um e-mail válido"
},
senha:{
required: "Digite a sua senha",


}
}
});
});
</script>
</head>

<body>
<form action="?" method="post" id="form">
<label class="error"></label>
<input type="email" name="email" placeholder="seuemail@exemplo.com" value=""><br /><br />
<label></label>
<input type="password" name="senha" placeholder="Senha" value=""><br />
<input type="submit" value="Entrar">
</form>

</body>
</html>